from aiogram.dispatcher.middlewares import BaseMiddleware
from aiocryptopay import AioCryptoPay


class CryptoMiddleware(BaseMiddleware):
    def __init__(self, crypto: AioCryptoPay):
        super().__init__()
        self.crypto = crypto

    async def on_pre_process_message(self, _, data: dict):
        data["crypto"] = self.crypto

    async def on_pre_process_callback_query(self, _, data: dict,):
        data["crypto"] = self.crypto